import { createRouter, createWebHashHistory, createWebHistory } from 'vue-router'
// 引入组件
import Home from "./components/Home.vue"
import News from "./components/News.vue"
import User from "./components/User.vue"
import NewsContent from './components/NewsContent.vue'
import UserInfo from './components/UserInfo.vue'

// 配置路由
const router = createRouter({
    // history:createWebHashHistory(),//hash模式
    history:createWebHistory(),//history模式
    routes:[
        {path:'',redirect:"/home"},//路由重定向
        {path:'/home',component:Home},
        {path:'/news',component:News,name:'news',alias:["/n","/c"]},
        {path:'/user',component:User, alias:"/people"},
        {path:'/userinfo/:id',name:"userinfo",component:UserInfo,alias:"/u/:id"},
        // {path:'/newsContent/:aid',component:NewsContent},//动态路由
        {path:'/newsContent',component:NewsContent,name:'content'}
    ],
})

export default router